<html>
<head><meta charset="utf-8"><title>Unsized types and LLVM `opaque` · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unsized.20types.20and.20LLVM.20.60opaque.60.html">Unsized types and LLVM `opaque`</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="194709661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unsized%20types%20and%20LLVM%20%60opaque%60/near/194709661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> NeoRaider <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unsized.20types.20and.20LLVM.20.60opaque.60.html#194709661">(Apr 20 2020 at 17:46)</a>:</h4>
<p>Does anyone have some insight in the handling of unsized types in LLVM, and why we want <code>opaque</code> for extern types ( <a href="https://github.com/rust-lang/rust/issues/59095" title="https://github.com/rust-lang/rust/issues/59095">https://github.com/rust-lang/rust/issues/59095</a> ), but not for other unsized types like slices (or at least I haven't seen any discussion on the latter)? See my last comment on that Github issue</p>



<a name="194733491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unsized%20types%20and%20LLVM%20%60opaque%60/near/194733491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> NeoRaider <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unsized.20types.20and.20LLVM.20.60opaque.60.html#194733491">(Apr 20 2020 at 21:07)</a>:</h4>
<p>I just realized that there is a wg-llvm stream. It seems moving messages to a different stream is not possible though (for a normal user?)</p>



<a name="195086706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unsized%20types%20and%20LLVM%20%60opaque%60/near/195086706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> NeoRaider <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unsized.20types.20and.20LLVM.20.60opaque.60.html#195086706">(Apr 23 2020 at 16:31)</a>:</h4>
<p>This seems to be one of the few remaining open questions for the stabilization of external types</p>



<a name="195086744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unsized%20types%20and%20LLVM%20%60opaque%60/near/195086744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> NeoRaider <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unsized.20types.20and.20LLVM.20.60opaque.60.html#195086744">(Apr 23 2020 at 16:31)</a>:</h4>
<p>cc <span class="user-group-mention" data-user-group-id="1176">@WG-llvm</span></p>



<a name="195087075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unsized%20types%20and%20LLVM%20%60opaque%60/near/195087075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unsized.20types.20and.20LLVM.20.60opaque.60.html#195087075">(Apr 23 2020 at 16:34)</a>:</h4>
<p>It seems <span class="user-mention" data-user-id="120791">@RalfJ</span>'s concern is specifically about statics. I don't think you can have a static of an DST, but apparently with extern types it's possible.</p>



<a name="195092593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unsized%20types%20and%20LLVM%20%60opaque%60/near/195092593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> NeoRaider <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unsized.20types.20and.20LLVM.20.60opaque.60.html#195092593">(Apr 23 2020 at 17:17)</a>:</h4>
<p>Hmm, I wonder. I just played around a bit, and it seems to me like clang emits externals of unknown size as "size 0" as well:</p>
<div class="codehilite"><pre><span></span><span class="k">extern</span> <span class="k">const</span> <span class="kt">char</span> <span class="n">foo</span><span class="p">[];</span>
</pre></div>


<p>turns into</p>
<div class="codehilite"><pre><span></span><span class="vg">@foo</span> <span class="p">=</span> <span class="k">external</span> <span class="k">global</span> <span class="p">[</span><span class="m">0</span> <span class="k">x</span> <span class="k">i8</span><span class="p">],</span> <span class="k">align</span> <span class="m">1</span>
</pre></div>



<a name="195185100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unsized%20types%20and%20LLVM%20%60opaque%60/near/195185100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unsized.20types.20and.20LLVM.20.60opaque.60.html#195185100">(Apr 24 2020 at 13:10)</a>:</h4>
<p>hm... that's not what "opaque types" model though, is it? that would be</p>
<div class="codehilite"><pre><span></span>struct Foo;
extern Foo foo;
</pre></div>



<a name="195185156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unsized%20types%20and%20LLVM%20%60opaque%60/near/195185156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unsized.20types.20and.20LLVM.20.60opaque.60.html#195185156">(Apr 24 2020 at 13:10)</a>:</h4>
<p>but my concerns here are mainly fed by just not knowing what exactly will and will not assume about statics, because unfortunately LLVM only scarcely documents such things.</p>



<a name="195185181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Unsized%20types%20and%20LLVM%20%60opaque%60/near/195185181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Unsized.20types.20and.20LLVM.20.60opaque.60.html#195185181">(Apr 24 2020 at 13:11)</a>:</h4>
<p>oh you also wrote a bunch of things in the issue; I'll read those and respond there then :)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>